﻿


<%@ page language="java" errorPage="/common/error.jsp" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ page isELIgnored="false" %>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Pragma" content="no-cache">
<link href="../style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/admin/assets/js/util.js"></script>
<script type="text/javascript" src="<c:url value='/admin/assets/js/jquery/jquery.js'/>"></script>

<script type="text/javascript" language="javascript">
// <![CDATA[
$(document).ready(function() {
	$(":radio").click(function(){
		var type = $(":radio:checked").val();
		if(type == 1){
			$("#parentsIdTd").hide();
		}else {
			$.ajax({
                type:"POST",
                url:"<c:url value='/admin/product/productCategory-selectList.ac'/>",
                dataType:"text",
                success:function(response) {
						if("none" == response) {
							$("#infoSpan").html("<img src='<c:url value='/admin/assets/images/warning.gif'/>'><font color='#C00000'>系统还没有分类,请先添加分类!</font>");
						}else {
							$("#parentsId").html(response);
							$("#parentsIdTd").show();
						}
                }
            });
			
		}
	})
	
	<c:if test="${not empty requestScope.message}">
$("#infoSpan").html("<img src='<c:url value='/admin/assets/images/warning.gif'/>'><font color='#C00000'><c:out value='${requestScope.message}' escapeXml='false'/></font>");
</c:if>
});
// ]]>
</script>
<script language="javascript">
function check()
{
	
	var name = document.getElementById("name");
	var macAddr = document.getElementById("macAddr");
	if(name.value.trim()=="")
	{
		OS.showWarming("errorTd","请输入名称!");
		name.focus();
		return false;
	}
	else
	{
		OS.hideWarming("errorTd");
	}
	if(macAddr.value.trim()=="")
	{
		OS.showWarming("errorTd","请输入Mic地址!");
		macAddr.focus();
		return false;
	}
	else
	{
		OS.hideWarming("errorTd");
	}

/**
	dojo.io.bind({
			url: "client.do?method=editOk",
			formNode:dojo.byId("clientForm"),
			mimetype:"text/html",
			method:"POST",
			encoding:"UTF-8",
			timeout:10000, 
			preventCache:true,
			load: function(type, data, evt){
				if(data=="exist")
				{
					OS.showWarming("errorTd","添加失败，相同Mac地址已经存在！");
				}
				else
				{
					window.location = "/admin/system/client.do?method=list";
				}
			},
			error: function(type, error){
				
			},
			timeout: function(type, data, evt){
				
			}
		});
	**/
		return false;
}

window.onload = function(){
 <c:if test="${null != requestScope.productClass}">
 	 $("#clientForm").attr("action", "<c:url value='/admin/product/productClass-edit.ac'/>");
 </c:if>
 
}
</script>
</head>
<body class="main">
<form method="post" name="clientForm" id="clientForm" onSubmit="return check()" action="<c:url value='/admin/product/productClass-add.ac'/>">
<input type="hidden" id="id" name="id" value="${requestScope.productClass.id}"/>
<table class="container" cellpadding="0" cellspacing="0">
<tr><td>
<table class="dialog" align="center" cellpadding="0" cellspacing="0" width="450">
<tr><td>
<table class="header" cellpadding="0" cellspacing="0">
<tr>
<td>
<c:choose> 
<c:when test="${null != requestScope.productClass}">修改</c:when> 
<c:otherwise>添加</c:otherwise> 
</c:choose> 
商品分类</td>
</tr>
</table>
</td></tr>
<tr>
  <td class="body">
<table class="body" cellpadding="0" cellspacing="0">
<tr>
  <td colspan="2" align="center" id="errorTd">&nbsp;<span id="infoSpan" class="infoSpan">&nbsp;</span></td>
   <tr>
  <td width="25%" align="right"><strong>名称：</strong></td>
  <td width="75%"><input type="text" name="name" id="name" size="31" maxlength="31" value="${requestScope.productClass.name}">
  &nbsp;&nbsp;
</table>
</td></tr>
<tr><td>
<table class="footer" cellpadding="0" cellspacing="0">
<tr><td>
<input class="button" type="submit" value="确定">
&nbsp;&nbsp;<input class="button" type="button" value="返回" onClick="document.location='javascript:history.go(-1)'">
</td></tr>
</table>
</td></tr>
</table>
</td></tr>
</table>
</form>

</body>
</html>
